package com.yycx.module.bus.provider.service.hy;

import com.yycx.common.base.entity.EntityMap;
import com.yycx.common.mybatis.model.ResultBody;
import com.yycx.module.bus.client.entity.hy.BusHyorderInovice;
import com.yycx.module.bus.client.entity.hy.BusHyorderInoviceDetails;
import com.yycx.common.mybatis.base.service.IBaseService;
import com.yycx.module.bus.client.entity.BusPayment;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 开票明细 接口
 *
 * @author flyme
 * @date 2023-09-17
 */
public interface BusHyorderInoviceDetailsService extends IBaseService<BusHyorderInoviceDetails> {
    /**
     * 添加开票明细
     *
     * @param selectIds
     * @param payment
     * @param invoiceUnitId
     * @return
     */
    Boolean addInoviceDetails(String selectIds, BusPayment payment, Long invoiceUnitId);


    /**
     * 拆分金额
     *
     * @param invoiceDetailsId
     * @param amount
     * @return
     */
    BusHyorderInoviceDetails cfAmount(Long invoiceDetailsId, BigDecimal amount);


    /**
     * 撤销拆分
     *
     * @param invoiceDetailsId
     * @return
     */
    ResultBody revokeCfAmount(Long invoiceDetailsId);


    /**
     * 获取发票设定信息
     *
     * @param selectIds
     * @return
     */
    EntityMap getInvoiceInfo(String selectIds);

    /**
     * 统计结算金额
     *
     * @param settleIds
     * @return
     */
    EntityMap totalSettleAmount(String settleIds);

    /**
     * 查询开票明细
     *
     * @param settleIds
     * @return
     */
    List<BusHyorderInoviceDetails> selectBySelectIds(String settleIds);

    /**
     * 查询开票明细
     *
     * @param payId
     * @return
     */
    List<BusHyorderInoviceDetails> selectByPayId(Long payId);




    /**
     * 关联结算开票申请ID
     *
     * @param hyorderInovice
     * @param payIds
     * @return
     */
    Boolean updateSettleInvoiceId(BusHyorderInovice hyorderInovice, String[] payIds);


    /**
     * 关联结算支付ID
     *
     * @param paymentId
     * @param settleDate
     * @return
     */
    Boolean updatePayInfo(Long paymentId, Date settleDate);


    /**
     * 更新发票ID
     *
     * @param settleFpId
     * @param selectIds
     * @return
     */
    Boolean updateSettleFpId(Long settleFpId, String selectIds);


    /**
     * 清空支付
     *
     * @param payId
     * @param settleType
     * @return
     */
    Boolean clearPayId(Serializable payId, Integer settleType);


    /**
     * 清空支付ID
     *
     * @param payId
     * @return
     */
    Boolean clearPayId(Serializable payId);

    /**
     * 撤销订单支付
     * @param invoiceDetailsId
     * @return
     */
    Boolean clearPayIdByInvoiceDetailsId(Serializable invoiceDetailsId);


    /**
     * 清空发票ID
     *
     * @param settleFpId
     * @return
     */
    Boolean clearSettleFpId(Serializable settleFpId);


    /**
     * 查询开票明细经验产品
     *
     * @param inoviceId
     * @return
     */
    String getDrugsNames(Long inoviceId);


    /**
     * 统计支付数量
     *
     * @param settleApplyId
     * @return
     */
    Integer countPayNum(String settleApplyId);

    /**
     * 查询订单详情
     *
     * @param settleIds
     * @return
     */
    List<BusHyorderInoviceDetails> selectByIds(String settleIds);


    /**
     * 查询开票明细
     *
     * @param orderDetailsReturnId
     * @return
     */
    BusHyorderInoviceDetails getByOrderDetailsReturnId(Long orderDetailsReturnId);


    /**
     * 查询开票明细
     *
     * @param orderDetailsReturnId
     * @param settleType
     * @return
     */
    BusHyorderInoviceDetails getByOrderDetailsReturnId(String orderDetailsReturnId, Integer settleType);


    /**
     * 删除开票明细
     *
     * @param settleApplyId
     * @return
     */
    Boolean removeByOrderDetailsReturnId(Serializable settleApplyId);


    /**
     * 查询合同明细
     *
     * @param invoiceId
     * @return
     */
    List<EntityMap> selectByInvoiceId(Long invoiceId);

    List<EntityMap> selectByInvoiceId2(Long invoiceId);

    /**
     * 关联结算ID
     *
     * @param paymentId
     * @param selectIds
     * @return
     */
    Boolean updateSettlePayId(Long paymentId, String selectIds);

    /**
     * 插入结算申请明细
     * @param businessKey
     */
    void insertInvoiceDetails(String businessKey);
}
